<template>
	<view class="content">
		<view class="content-child">
			<view class="item">
				<u-icon
					name="order"
					color="#1573FF"
					label="车辆信息"
					label-color="#333333"
					:customStyle="{
						'line-height': '80rpx',
						display: 'block',
						'padding-left': '20rpx',
					}"></u-icon>

				<u-line
					color="#efefef"
					:customStyle="{ 'margin-bottom': '30rpx', display: 'block' }"></u-line>

				<view class="text-line">
					<text class="text-name">车牌号:</text>
					<text class="text-value">{{ intentData.carNo | filterNull }}</text>
				</view>

				<view class="text-line">
					<text class="text-name">车架号:</text>
					<text class="text-value">{{ intentData.vinNo | filterNull }}</text>
				</view>

				<view class="text-line">
					<text class="text-name">品牌/车系/车型:</text>
					<text class="text-value">{{ intentData.brandSeriesModel | filterNull }}</text>
				</view>

				<view class="text-line">
					<text class="text-name">车辆归属:</text>
					<text class="text-value">{{ intentData.deptName | filterNull }}</text>
				</view>

				<view class="text-line">
					<text class="text-name">车辆仓库:</text>
					<text class="text-value">{{ intentData.depotName | filterNull }}</text>
				</view>

				<u-line
					color="#efefef"
					border-style="dashed"
					:customStyle="{ 'margin-bottom': '20rpx', display: 'block' }"></u-line>

				<view class="text-line">
					<text class="text-name">车辆状态:</text>
					<text class="text-value">{{ intentData.carStatusShow | filterNull }}</text>
				</view>
			</view>

			<view
				class="item"
				style="padding: 20rpx"
				v-show="
					detailData &&
					detailData.insuranceManage &&
					detailData.insuranceManage.compulsoryApplyNo &&
					detailData.insuranceManage.compulsoryApplyNo ==
						detailData.insuranceManage.policyApplyNo
				">
				<u-icon
					name="order"
					color="#1573FF"
					label="交强险保单信息"
					label-color="#333333"
					:customStyle="{
						'line-height': '80rpx',
						display: 'block',
						padding: '-20rpx',
					}"></u-icon>

				<u-line
					color="#efefef"
					:customStyle="{ 'margin-bottom': '10rpx', display: 'block' }"></u-line>

				<u-form
					:model="detailData.insuranceManage"
					ref="uform"
					label-width="auto"
					:labelStyle="{ paddding: '20rpx' }">
					<u-form-item label="保险公司" required @click="pickerShow(1)" borderBottom>
						<u--input
							v-model="detailData.insuranceManage.compulsoryCompany"
							disabled
							disabledColor="#ffffff"
							border="none"
							inputAlign="right"
							placeholder="请选择保险公司"
							type="select"
							:select-open="actionSheetShow"></u--input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item
						label="交强险开始时间"
						required
						@click="pickerShow(2)"
						borderBottom>
						<u-input
							v-model="detailData.insuranceManage.compulsoryStartTime"
							disabled
							disabledColor="#ffffff"
							border="none"
							inputAlign="right"
							placeholder="请选择开始日期"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item
						label="交强险结束时间"
						required
						@click="pickerShow(3)"
						borderBottom>
						<u-input
							v-model="detailData.insuranceManage.compulsoryEndTime"
							disabled
							disabledColor="#ffffff"
							border="none"
							inputAlign="right"
							placeholder="请选择结束日期"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item label="交强险保单号" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.compulsoryNo"
							inputAlign="right"
							border="none"
							placeholder="输入保险单号"></u-input>
					</u-form-item>

					<u-form-item label="费用" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.compulsoryAmount"
							ref="fee0"
							inputAlign="right"
							border="none"
							placeholder="请输入费用"></u-input>
					</u-form-item>

					<u-form-item label="备注" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.compulsoryRemark"
							inputAlign="right"
							border="none"
							placeholder="请输入备注"></u-input>
					</u-form-item>

					<text style="padding: 20rpx 0; display: block; font-size: 30rpx; color: #333">
						保单照片
					</text>

					<lr-upload
						ref="upload1"
						@on-change="onListChange"
						:tag="1"
						:objType="15"></lr-upload>
				</u-form>
			</view>

			<view
				class="item"
				style="padding: 20rpx"
				v-show="
					detailData &&
					detailData.insuranceManage &&
					detailData.insuranceManage.carrierApplyNo &&
					detailData.insuranceManage.carrierApplyNo ==
						detailData.insuranceManage.policyApplyNo
				">
				<u-icon
					name="order"
					color="#1573FF"
					label="承运险保单信息"
					label-color="#333333"
					:customStyle="{
						'line-height': '80rpx',
						display: 'block',
						padding: '-20rpx',
					}"></u-icon>

				<u-line
					color="#efefef"
					:customStyle="{ 'margin-bottom': '10rpx', display: 'block' }"></u-line>

				<u-form
					:model="detailData.insuranceManage"
					ref="uform"
					label-width="auto"
					:labelStyle="{ paddding: '20rpx' }">
					<u-form-item label="保险公司" @click="pickerShow(7)" borderBottom required>
						<u--input
							v-model="detailData.insuranceManage.carrierCompany"
							disabled
							disabledColor="#ffffff"
							border="none"
							inputAlign="right"
							placeholder="请选择保险公司"
							type="select"
							:select-open="actionSheetShow"></u--input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item
						label="承运险开始时间"
						@click="pickerShow(8)"
						borderBottom
						required>
						<u-input
							v-model="detailData.insuranceManage.carrierStartTime"
							disabled
							disabledColor="#ffffff"
							border="none"
							inputAlign="right"
							placeholder="请选择开始日期"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item
						label="承运险结束时间"
						@click="pickerShow(9)"
						borderBottom
						required>
						<u-input
							v-model="detailData.insuranceManage.carrierEndTime"
							disabled
							disabledColor="#ffffff"
							border="none"
							inputAlign="right"
							placeholder="请选择结束日期"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item label="承运险保单号" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.carrierNo"
							inputAlign="right"
							border="none"
							placeholder="输入保险单号"></u-input>
					</u-form-item>

					<u-form-item label="费用" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.carrierAmount"
							ref="fee1"
							inputAlign="right"
							border="none"
							placeholder="请输入费用"></u-input>
					</u-form-item>

					<u-form-item label="备注" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.carrierRemark"
							inputAlign="right"
							border="none"
							placeholder="请输入备注"></u-input>
					</u-form-item>

					<text style="padding: 20rpx 0; display: block; font-size: 30rpx; color: #333">
						保单照片
					</text>

					<lr-upload
						ref="upload3"
						@on-change="onListChange"
						:tag="3"
						:objType="49"></lr-upload>
				</u-form>
			</view>

			<view
				class="item"
				style="padding: 20rpx"
				v-show="
					detailData &&
					detailData.insuranceManage &&
					detailData.insuranceManage.commercialApplyNo &&
					detailData.insuranceManage.commercialApplyNo ==
						detailData.insuranceManage.policyApplyNo
				">
				<u-icon
					name="order"
					color="#1573FF"
					label="商业险保单信息"
					label-color="#333333"
					:customStyle="{
						'line-height': '80rpx',
						display: 'block',
						padding: '-20rpx',
					}"></u-icon>

				<u-line
					color="#efefef"
					:customStyle="{ 'margin-bottom': '10rpx', display: 'block' }"></u-line>

				<u-form :model="detailData.insuranceManage" ref="uform" label-width="auto">
					<u-form-item label="保险公司" required @click="pickerShow(4)" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.commercialCompany"
							inputAlign="right"
							disabled
							disabledColor="#ffffff"
							border="none"
							placeholder="请选择保险公司"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item
						label="商业险开始时间"
						required
						@click="pickerShow(5)"
						borderBottom>
						<u-input
							v-model="detailData.insuranceManage.commercialStartTime"
							inputAlign="right"
							disabled
							disabledColor="#ffffff"
							border="none"
							placeholder="请选择开始日期"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item
						label="商业险结束时间"
						required
						@click="pickerShow(6)"
						borderBottom>
						<u-input
							v-model="detailData.insuranceManage.commercialEndTime"
							inputAlign="right"
							disabled
							disabledColor="#ffffff"
							border="none"
							placeholder="请选择结束日期"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item label="商业险保单号" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.commercialNo"
							inputAlign="right"
							placeholder="输入保险单号"
							border="none"></u-input>
					</u-form-item>

					<u-form-item label="费用" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.commercialAmount"
							inputAlign="right"
							disabled
							disabledColor="#ffffff"
							border="none"
							placeholder="费用"></u-input>
					</u-form-item>

					<u-form-item label="商业险险种" @click="addCommercialTypes" borderBottom>
						<u-input
							v-model="commercialTypeTitle"
							inputAlign="right"
							disabled
							disabledColor="#ffffff"
							border="none"
							placeholder="添加商业险险种"
							type="select"
							:select-open="actionSheetShow"></u-input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>

					<u-form-item label="备注" borderBottom>
						<u-input
							v-model="detailData.insuranceManage.commercialRemark"
							inputAlign="right"
							border="none"
							placeholder="请输入备注"></u-input>
					</u-form-item>

					<text style="padding: 20rpx 0; display: block; font-size: 30rpx; color: #333">
						保单照片
					</text>

					<lr-upload
						ref="upload2"
						@on-change="onListChange"
						:tag="2"
						:objType="12"></lr-upload>
				</u-form>
			</view>

			<!-- 交强险保险公司 -->
			<u-picker
				:show="compulsoryCompanyShow"
				:columns="carInsuranceCompanyList"
				keyName="companyName"
				@confirm="pickerConfim"
				@cancel="compulsoryCompanyShow = false"></u-picker>

			<!-- 承运险保险公司 -->
			<u-picker
				:show="carrierCompanyShow"
				:columns="carInsuranceCompanyList"
				keyName="companyName"
				@confirm="pickerConfim()"
				@cancel="carrierCompanyShow = false"></u-picker>

			<!-- 商业险保险公司 -->
			<u-picker
				:show="commercialCompanyShow"
				:columns="carInsuranceCompanyList"
				keyName="companyName"
				@confirm="pickerConfim()"
				@cancel="commercialCompanyShow = false"></u-picker>

			<!-- 强险开始时间 -->
			<u-datetime-picker
				:show="compulsoryStartShow"
				v-model="value1"
				:maxDate="value2"
				mode="date"
				@confirm="timeconfirm"
				@cancel="compulsoryStartShow = false"></u-datetime-picker>
			<!-- <u-picker :mode="mode" :show="compulsoryStartShow" @confirm="pickerConfim()"></u-picker> -->
			<!-- 强险结束时间 -->
			<u-datetime-picker
				:show="compulsoryEndShow"
				mode="date"
				v-model="value2"
				:minDate="value1"
				@confirm="timeconfirm"
				@cancel="compulsoryEndShow = false"></u-datetime-picker>
			<!-- <u-picker :mode="mode" :show="compulsoryEndShow" @confirm="pickerConfim()"></u-picker> -->

			<!-- 承运险开始时间 -->
			<u-datetime-picker
				:show="carrierStartShow"
				v-model="value5"
				:maxDate="value6"
				mode="date"
				@confirm="timeconfirm"
				@cancel="carrierStartShow = false"></u-datetime-picker>
			<!-- <u-picker :mode="mode" :show="compulsoryStartShow" @confirm="pickerConfim()"></u-picker> -->
			<!-- 承运结束时间 -->
			<u-datetime-picker
				:show="carrierEndShow"
				mode="date"
				v-model="value6"
				:minDate="value5"
				@confirm="timeconfirm"
				@cancel="carrierEndShow = false"></u-datetime-picker>
			<!-- <u-picker :mode="mode" :show="compulsoryEndShow" @confirm="pickerConfim()"></u-picker> -->

			<!-- 商险开始时间 -->
			<u-datetime-picker
				:show="commercialStartShow"
				mode="date"
				v-model="value3"
				:maxDate="value4"
				@confirm="timeconfirm"
				@cancel="commercialStartShow = false"></u-datetime-picker>
			<!-- <u-picker :mode="mode" :show="commercialStartShow" @confirm="pickerConfim()"></u-picker> -->
			<!-- 商险结束时间 -->
			<u-datetime-picker
				:show="commercialEndShow"
				mode="date"
				v-model="value4"
				:minDate="value3"
				@confirm="timeconfirm"
				@cancel="commercialEndShow = false"></u-datetime-picker>
			<!-- <u-picker :mode="mode" :show="commercialEndShow" @confirm="pickerConfim()"></u-picker> -->

			<u-modal
				ref="uModal"
				:show="showModal"
				:show-cancel-button="true"
				show-title=""
				@confirm="confirm"
				@cancel="showModal = false"
				content="确定提交？">
				<!-- #ifndef MP-WEIXIN || MP-TOUTIAO -->
				<!-- <view class="warp" style="margin: 30rpx;" v-if="contentSlot">
					<image class="logo" src="https://uviewui.com/common/logo.png" style="width: 220rpx;"
						mode="widthFix"></image>
				</view> -->
				<!-- #endif -->
			</u-modal>
		</view>

		<examflow
			:from="pageType"
			:instanceId="instanceId"
			approvalName="carInsuranceApprove"
			:isAdd="'add' == pageType"></examflow>

		<view style="height: 100rpx"></view>

		<view class="button-container">
			<button class="btn-item" @click="commit">提 交</button>
		</view>
	</view>
</template>

<script>
	import lrUpload from '@/components/global/lr-upload.vue';
	import examflow from '@/components/exam-flow.vue';
	import { isVideo } from '@/common/calc';
	export default {
		components: {
			lrUpload,
			examflow,
		},
		data() {
			return {
				value1: Number(new Date()),
				value2: Number(new Date()) + 12 * 30 * 24 * 3600 * 1000,
				value3: Number(new Date()),
				value4: Number(new Date()) + 12 * 30 * 24 * 3600 * 1000,
				value5: Number(new Date()),
				value6: Number(new Date()) + 12 * 30 * 24 * 3600 * 1000,
				pageType: '',
				instanceId: '',
				businessId: '',
				addType: 0,
				// mode: '',
				commercialTypeTitle: '',
				type: 0,
				showModal: false,
				compulsoryCompanyShow: false,
				compulsoryStartShow: false,
				compulsoryEndShow: false,

				carrierCompanyShow: false,
				carrierStartShow: false,
				carrierEndShow: false,

				commercialCompanyShow: false,
				commercialStartShow: false,
				commercialEndShow: false,

				intentData: {},
				carInsuranceCompanyList: [],
				// //交强险信息
				// insuranceCompulsoryDto: {
				// 	compulsoryStartTime: '',
				// 	compulsoryEndTime: '',
				// 	compulsoryNo: '',
				// 	compulsoryCompanyId: '',
				// 	compulsoryCompany: '',
				// 	compulsoryAmount: '',
				// 	compulsoryRemark: '',
				// 	compulsorySysAccessoryList: []
				// },
				// //商业险信息
				// commercialAddPO: {
				// 	commercialStartTime: '',
				// 	commercialEndTime: '',
				// 	commercialNo: '',
				// 	commercialCompanyId: '',
				// 	commercialCompany: '',
				// 	commercialAmount: '',
				// 	commercialRemark: '',
				// 	commercialInsuranceRecordList: [],
				// 	// commercialSysAccessoryList: []
				// },

				detailData: {
					vehicle: {},
					orderCar: null,
					insuranceManage: {},
					compulsorySysAccessoryList: null,
					commercialSysAccessoryList: null,
					carrierSysAccessoryList: null,
					commercialInsuranceRecordList: null,
				},
			};
		},
		mounted() {
			this.$refs.fee0.setFormatter(e => {
				return e
					.replace(/[^\d.]/g, '')
					.replace(/\.{2,}/g, '.')
					.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
			});
			this.$refs.fee1.setFormatter(e => {
				return e
					.replace(/[^\d.]/g, '')
					.replace(/\.{2,}/g, '.')
					.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
			});
		},
		onLoad(options) {
			this.instanceId = options.instanceId;
			this.businessId = options.businessId;
			this.pageType = options.pageType;

			let that = this;

			// this.intentData = JSON.parse(options.intentData);
			// console.log('收到传递数据');
			// console.log(this.intentData);

			//获取缓存中的保险公司
			this.carInsuranceCompanyList = [this.$store.state.params.insuranceCompanyList];
			console.log('保险公司数据', this.carInsuranceCompanyList);

			this.$u.api.insuranceupdateData(this.businessId).then(res => {
				this.intentData = res.vehicle;
				this.detailData = res;

				// this.insuranceCompulsoryDto = res.insuranceCompulsoryDto;
				// this.commercialAddPO = res.insuranceCommercialDto;

				if (!uni.$u.test.isEmpty(res.commercialInsuranceRecordList)) {
					this.commercialTypeTitle = `已添加${res.commercialInsuranceRecordList.length}份保险`;
				}

				if (!uni.$u.test.isEmpty(res.compulsorySysAccessoryList)) {
					this.$refs.upload1.fileList1 = res.compulsorySysAccessoryList
						.filter(item => {
							return 1 == item.type_file || 1 == item.typeFile;
						})
						.map(item => {
							return {
								...item,
								message: '',
								size: 52363,
								status: 'success',
								thumb: that.baseImgUrl() + item.url,
								type: isVideo(item.url),
								url: item.url,
							};
						});

					console.log('最终数据', this.$refs.upload1.fileList1);
				}

				if (!uni.$u.test.isEmpty(res.commercialSysAccessoryList)) {
					this.$refs.upload2.fileList1 = res.commercialSysAccessoryList
						.filter(item => {
							return 1 == item.type_file || 1 == item.typeFile;
						})
						.map(item => {
							return {
								...item,
								message: '',
								size: 52363,
								status: 'success',
								thumb: that.baseImgUrl() + item.url,
								type: isVideo(item.url),
								url: item.url,
							};
						});
				}

				if (!uni.$u.test.isEmpty(res.carrierSysAccessoryList)) {
					this.$refs.upload3.fileList1 = res.carrierSysAccessoryList
						.filter(item => {
							return 1 == item.type_file || 1 == item.typeFile;
						})
						.map(item => {
							return {
								...item,
								message: '',
								size: 52363,
								status: 'success',
								thumb: that.baseImgUrl() + item.url,
								type: isVideo(item.url),
								url: item.url,
							};
						});
				}
			});

			uni.$on('addInsType', res => {
				this.detailData.commercialInsuranceRecordList = res.commercialInsuranceRecordList;
				this.detailData.insuranceManage.commercialAmount = res.commercialAmount;
				this.commercialTypeTitle = res.commercialTypeTitle;
			});
		},
		methods: {
			pickerShow(type) {
				console.log('点击了' + type);

				this.type = type;
				switch (type) {
					case 1:
						this.compulsoryCompanyShow = true;
						// this.mode = 'selector';
						break;
					case 2:
						this.compulsoryStartShow = true;
						// this.mode = 'time';
						break;
					case 3:
						this.compulsoryEndShow = true;
						// this.mode = 'time';
						break;
					case 4:
						this.commercialCompanyShow = true;
						// this.mode = 'selector';
						break;
					case 5:
						this.commercialStartShow = true;
						// this.mode = 'time';
						break;
					case 6:
						this.commercialEndShow = true;
						// this.mode = 'time';
						break;
					case 7:
						this.carrierCompanyShow = true;
						// this.mode = 'time';
						break;
					case 8:
						this.carrierStartShow = true;
						// this.mode = 'time';
						break;
					case 9:
						this.carrierEndShow = true;
						// this.mode = 'time';
						break;
				}
			},
			formatter(type, value) {
				if (type === 'year') {
					return `${value}年`;
				}
				if (type === 'month') {
					return `${value}月`;
				}
				if (type === 'day') {
					return `${value}日`;
				}
				return value;
			},
			pickerConfim(e) {
				console.log('点击确认了', e);

				// if (this.mode == 'time') {
				// let timeStr = e.year + "-" + e.month + "-" + e.day;
				// if (this.type == 2) {
				// 	this.insuranceCompulsoryDto.compulsoryStartTime = timeStr;
				// } else if (this.type == 3) {
				// 	this.insuranceCompulsoryDto.compulsoryEndTime = timeStr;
				// } else if (this.type == 5) {
				// 	this.commercialAddPO.commercialStartTime = timeStr;
				// } else if (this.type == 6) {
				// 	this.commercialAddPO.commercialEndTime = timeStr;
				// }
				// } else if (this.mode == 'selector') {
				if (this.type == 1) {
					this.compulsoryCompanyShow = false;
					// let index = e;
					this.detailData.insuranceManage.compulsoryCompany = e.value[0].companyName;
					this.detailData.insuranceManage.compulsoryCompanyId = e.value[0].companyId;

					console.log('选定的', e.value[0].companyName);
				} else if (this.type == 4) {
					this.commercialCompanyShow = false;
					// let index = e;
					this.detailData.insuranceManage.commercialCompany = e.value[0].companyName;
					this.detailData.insuranceManage.commercialCompanyId = e.value[0].companyId;
				} else if (this.type == 7) {
					this.carrierCompanyShow = false;
					// let index = e;
					this.detailData.insuranceManage.carrierCompany = e.value[0].companyName;
					this.detailData.insuranceManage.carrierCompanyId = e.value[0].companyId;
				}
				// }
			},

			timeconfirm(e) {
				console.log('点击确认了', e);
				let timeStr = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
				console.log('格式化后', timeStr);

				// let timeStr = e.year + "-" + e.month + "-" + e.day;
				if (this.type == 2) {
					this.compulsoryStartShow = false;
					this.detailData.insuranceManage.compulsoryStartTime = timeStr;
				} else if (this.type == 3) {
					this.compulsoryEndShow = false;
					this.detailData.insuranceManage.compulsoryEndTime = timeStr;
				} else if (this.type == 5) {
					this.commercialStartShow = false;
					this.detailData.insuranceManage.commercialStartTime = timeStr;
				} else if (this.type == 6) {
					this.commercialEndShow = false;
					this.detailData.insuranceManage.commercialEndTime = timeStr;
				} else if (this.type == 8) {
					this.carrierStartShow = false;
					this.detailData.insuranceManage.carrierStartTime = timeStr;
				} else if (this.type == 9) {
					this.carrierEndShow = false;
					this.detailData.insuranceManage.carrierEndTime = timeStr;
				}

				console.log('选中的时间', this.detailData.insuranceManage.compulsoryStartTime);
			},

			//添加商业险险种
			addCommercialTypes() {
				var intentData = JSON.stringify(this.detailData.commercialInsuranceRecordList);
				uni.navigateTo({
					url: '/pages/addCar/addCar-insuranceTypeList?insuranceRecordList=' + intentData,
				});
			},
			commit() {
				// this.showModal = true;
				this.confirm();
			},

			confirm() {
				if (
					this.detailData &&
					this.detailData.insuranceManage &&
					this.detailData.insuranceManage.commercialApplyNo &&
					this.detailData.insuranceManage.commercialApplyNo ==
						this.detailData.insuranceManage.policyApplyNo
				) {
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.commercialCompany)) {
						this.$u.toast('请选择保险公司');
						return;
					}
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.commercialStartTime)) {
						this.$u.toast('请选择开始时间');
						return;
					}
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.commercialEndTime)) {
						this.$u.toast('请选择结束时间');
						return;
					}
				}

				if (
					this.detailData &&
					this.detailData.insuranceManage &&
					this.detailData.insuranceManage.carrierApplyNo &&
					this.detailData.insuranceManage.carrierApplyNo ==
						this.detailData.insuranceManage.policyApplyNo
				) {
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.carrierCompany)) {
						this.$u.toast('请选择保险公司');
						return;
					}
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.carrierStartTime)) {
						this.$u.toast('请选择开始时间');
						return;
					}
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.carrierEndTime)) {
						this.$u.toast('请选择结束时间');
						return;
					}
				}

				if (
					this.detailData &&
					this.detailData.insuranceManage &&
					this.detailData.insuranceManage.compulsoryApplyNo &&
					this.detailData.insuranceManage.compulsoryApplyNo ==
						this.detailData.insuranceManage.policyApplyNo
				) {
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.compulsoryCompany)) {
						this.$u.toast('请选择保险公司');
						return;
					}
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.compulsoryStartTime)) {
						this.$u.toast('请选择开始时间');
						return;
					}
					if (uni.$u.test.isEmpty(this.detailData.insuranceManage.compulsoryEndTime)) {
						this.$u.toast('请选择结束时间');
						return;
					}
				}

				// this.showModal = false;
				let that = this;
				uni.showModal({
					content: '确定提交吗?',
					success(result) {
						if (result.confirm) {
							that.$u.api.insuranceupdate(that.detailData).then(res => {
								uni.showToast({
									title: '提交成功',
									icon: 'none',
								});
								setTimeout(() => {
									uni.navigateBack();
								}, 1000);
							});
						}
					},
				});
			},

			onListChange(tag, list, objList) {
				console.log('结果list', list);
				console.log('结果objList', objList);

				if (tag == 1) {
					this.detailData.compulsorySysAccessoryList = objList;
				} else if (tag == 2) {
					this.detailData.commercialSysAccessoryList = objList;
				} else if (tag == 3) {
					this.detailData.carrierSysAccessoryList = objList;
				}
			},
		},
	};
</script>

<style lang="scss">
	page {
		height: 100%;
	}

	.bottom {
		position: fixed;
		width: 100%;
		height: 100rpx;
		bottom: 0;
		z-index: 999;
		background-color: white;
		display: flex;
		align-items: center;
		justify-content: center;

		text {
			width: 98%;
			height: 80rpx;
			line-height: 80rpx;
			border-radius: 50rpx;
			background-color: $blue15;
			color: white;
			text-align: center;
			font-size: 30rpx;
		}
	}

	// u-form-item{
	// 	padding: 0 20rpx;
	// }
</style>
